<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
            position: relative;
            background-color: rgba(115, 221, 50, 0.5);
        }
        #cart{
            position: fixed;
            bottom: 0;
            background-color: white;
            width: 100%;
            padding: 10px;
            box-sizing: border-box;
        }
        .title{
            margin: 10px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .title span:nth-child(1){
            font-weight: bold;
            font-size: 20px;
        }
        .goods{
            display: flex;
            margin: 0 10px;
           border-bottom: 1px solid #999;
        }
        .pic{
            margin-right: 20px;
            width: 80px;
        }
        img{
            width: 100%;
        }
        .text{
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        .name{
            margin-top: 5px;
            font-weight: bold;
            font-size: 20px;
        }
        .price{
            margin-bottom: 5px;
            display: flex;
            justify-content: space-between;
        }
        .price span{
            display: inline-block;
            width: 14px;
            height: 14px;
            text-align: center;
            line-height: 14px;
            color: white;
            border-radius: 50%;
        }
        .price span:nth-child(1){
            color: lightskyblue;
            border: 2px solid lightskyblue;
        }
        .price span:nth-child(3){
            border: 2px solid lightskyblue;
            background-color: lightskyblue;
        }
        .price span:nth-child(2){
            color: black;
            background-color: white;
        }
        .empty{
            height: 80px;
            line-height: 80px;
            text-align: center;
        }
        .list{
            margin-bottom: 40px;
        }
        .summary{
            display: flex;
            justify-content: space-between;
            align-items: center;
            background-color: yellow;
            color: black;
            left: 0;
            position: fixed;
            bottom: 0;
            width: 100%;
            padding: 10px;
            box-sizing: border-box;
        }
        .summary span:nth-child(2){
            background-color: pink;
            color: white;
            padding: 5px 15px;
            border-radius: 5px;
        }
    </style>
</head>
<body>
    <div id="cart">
        <div class="title">
            <span>已选商品</span>
            <span @click="clean()">清空</span>
        </div>
        <div class="list">
            <div class="goods" v-for="(item,index) in list">
                <div class="pic">
                    <img :src='item.pic' alt="">
                </div>
                <div class="text">
                    <div class="name">{{item.name}}</div>
                    <div class="price">
                        <div>￥{{item.price}}</div>
                        <div>
                            <span @click="sub(item)">-</span>
                            <span>{{item.count}}</span>
                            <span @click="add(item)">+</span>
                        </div>
                    </div>
                </div>
            </div>
            <div v-show="list.length==0" class="empty">购物车空空如也~</div>
            <div class="summary">
                <span>总数:{{sum}} 总价:{{total}} </span>
                <span>去结算</span>
            </div>
        </div>
    </div>
    <script src="vue.js"></script>
    <script src="购物车效果.js"></script>
</body>
</html>